package com.manage.project.biz.controller;

import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;


import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.framework.web.page.TableDataInfo;
import com.manage.project.biz.domain.BizJidiansheshiqingjieweihu;
import com.manage.project.biz.domain.Gongpeidian;
import com.manage.project.biz.service.IGongpeidianService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2022-06-01
 */
@RestController
@RequestMapping("/biz/gongpeidian")
public class GongpeidianController extends BaseController
{
    @Autowired
    private IGongpeidianService gongpeidianService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('biz:gongpeidian:list')")
    @GetMapping("/list")
    public TableDataInfo list(Gongpeidian gongpeidian)
    {
        startPage();
        List<Gongpeidian> list = gongpeidianService.selectGongpeidianList(gongpeidian);
        return getDataTable(list);
    }

    @Log(title = "供配电设施", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Gongpeidian gongpeidian)  {
        List<Gongpeidian> list = gongpeidianService.selectGongpeidianList(gongpeidian);
        ExcelUtil<Gongpeidian> util = new ExcelUtil<Gongpeidian>(Gongpeidian.class);
        return util.exportExcel(list, "供配电设施数据");
    }
    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('biz:gongpeidian:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(gongpeidianService.selectGongpeidianById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('biz:gongpeidian:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Gongpeidian gongpeidian)
    {
        return toAjax(gongpeidianService.insertGongpeidian(gongpeidian));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('biz:gongpeidian:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Gongpeidian gongpeidian)
    {
        return toAjax(gongpeidianService.updateGongpeidian(gongpeidian));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('biz:gongpeidian:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gongpeidianService.deleteGongpeidianByIds(ids));
    }
}
